package com.cskaoyan.shopping.controller;

import com.cskaoyan.mall.commons.result.ResponseData;
import com.cskaoyan.mall.commons.result.ResponseUtil;
import com.cskaoyan.mall.dto.ProductDetailDto;
import com.cskaoyan.shopping.dal.persistence.ItemMapper;
import com.cskaoyan.shopping.service.IProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 查看商品详情
 *
 * @author wh194@foxmail.com
 * @since 2023/01/11 11:24
 */
@RestController
@RequestMapping("shopping")
public class ProductController {
    @Autowired
    IProductService iProductService;

    @GetMapping("product/{id}")
    public ResponseData productDetail(@PathVariable Long id) {
        ProductDetailDto productDetail = iProductService.getProductDetail(id);
        return new ResponseUtil<>().setData(productDetail);
    }


}
